/* eslint-disable */
<template>
  <!-- 管理端仪表盘容器 -->
  <div class="dashboard-container">
    <!-- 欢迎信息 -->
    <el-card class="welcome-card">
      <div class="welcome-header">
        <div>
          <h2>{{ greeting }}，管理员</h2>
          <p class="subtitle">{{ currentDate }} | 学生作业管理系统</p>
        </div>
        <div class="welcome-icon">
          <i class="el-icon-s-platform"></i>
        </div>
      </div>
    </el-card>

    <!-- 快速操作区域 -->
    <el-card class="quick-action-card" shadow="hover">
      <div slot="header" class="card-header">
        <span>系统管理</span>
      </div>
      <el-row :gutter="20" class="quick-actions">
        <el-col :xs="12" :sm="8" :md="6" :lg="4" v-for="(action, index) in quickActions" :key="index">
          <div class="action-item" @click="handleQuickAction(action)">
            <div class="action-icon">
              <i :class="action.icon"></i>
            </div>
            <div class="action-name">{{ action.name }}</div>
          </div>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'AdminDashboard',
  data() {
    return {
      quickActions: [
        {
          name: '院系管理',
          icon: 'el-icon-office-building',
          route: '/admin/departments'
        },
        {
          name: '班级管理',
          icon: 'el-icon-school',
          route: '/admin/classes'
        },
        {
          name: '课程管理',
          icon: 'el-icon-notebook-2',
          route: '/admin/courses'
        },
        {
          name: '教师管理',
          icon: 'el-icon-s-custom',
          route: '/admin/teachers'
        },
        {
          name: '公告管理',
          icon: 'el-icon-bell',
          route: '/admin/announcements'
        },
        {
          name: '个人设置',
          icon: 'el-icon-setting',
          route: '/admin/profile'
        }
      ]
    }
  },
  computed: {
    greeting() {
      const hour = new Date().getHours()
      if (hour < 6) return '凌晨好'
      if (hour < 9) return '早上好'
      if (hour < 12) return '上午好'
      if (hour < 14) return '中午好'
      if (hour < 17) return '下午好'
      if (hour < 19) return '傍晚好'
      return '晚上好'
    },
    currentDate() {
      const date = new Date()
      const weekDays = ['日', '一', '二', '三', '四', '五', '六']
      return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日 星期${weekDays[date.getDay()]}`
    }
  },
  methods: {
    handleQuickAction(action) {
      this.$router.push(action.route)
    }
  }
}
</script>

<style scoped>
.dashboard-container {
  padding: 20px;
  background-color: #f0f2f5;
  min-height: calc(100vh - 60px);
}

.welcome-card {
  margin-bottom: 20px;
  border-radius: 8px;
}

.welcome-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.welcome-icon {
  font-size: 40px;
  color: #409EFF;
}

.welcome-header h2 {
  margin: 0;
  color: #303133;
  font-size: 24px;
}

.subtitle {
  margin: 8px 0 0;
  color: #909399;
}

.quick-action-card {
  margin-bottom: 20px;
  border-radius: 8px;
}

.card-header {
  font-weight: bold;
  color: #303133;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s;
}

.action-item:hover {
  background-color: #f5f7fa;
}

.action-icon {
  font-size: 32px;
  color: #409EFF;
  margin-bottom: 10px;
}

.action-name {
  font-size: 14px;
  color: #606266;
}
</style> 